﻿<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
	<meta charset="utf-8" />
</head>
<body>
    <div id="weixin" style="display:none; width:100%; margin-top:100px;">
        <img src="image/how1.png" style="width:100%;" /></div>
    <!-- a标签的链接，设置为对应的下载链接；点击打开的动作，在click事件中注册 -->
    <a href="https://itunes.apple.com/cn/app/山海天智慧党建/id1209911681?mt=8" id="openApp" style="display: none">山海天智慧党建</a>
    <script type="text/javascript">
    document.getElementById('openApp').onclick = function(e){
        // 通过iframe的方式试图打开APP，如果能正常打开，会直接切换到APP，并自动阻止a标签的默认行为
        // 否则打开a标签的href链接
        var ifr = document.createElement('iframe');
        ifr.src = 'https://itunes.apple.com/cn/app/山海天智慧党建/id1209911681?mt=8';
        ifr.style.display = 'none';
        document.body.appendChild(ifr);
        window.setTimeout(function(){
            document.body.removeChild(ifr);
        },3000)
    };
    
    var ua = navigator.userAgent.toLowerCase();
    if (/iphone|ipod/.test(ua)) {
        if (/micromessenger/.test(ua)) {
            document.getElementById("weixin").style.display = "block";
        }
    }
    document.getElementById('openApp').click();
    </script>
</body>
</html>
